package main

import "fmt"

func main() {
	//创建map类型的数据
	var userinfo = make(map[string]string)
	userinfo["username"] = "zhangsan"
	userinfo["sex"] = "男"
	userinfo["age"] = "12"
	fmt.Println(userinfo)
	fmt.Println(userinfo["username"])
	for k, v := range userinfo {
		fmt.Println(k)
		fmt.Println(v)
	}
	//2 推导类型创建 map
	userinfo2 := map[string]string{
		"username": "张三",
		"age":      "20岁",
		"sex":      "男",
	}
	fmt.Println(userinfo2)

	//复习切片
	var slice = []int{1, 2, 3}
	fmt.Println(slice)

	slice1 := make([]string, 2, 3)
	slice1 = append(slice1, "1")
	slice1 = append(slice1, "2")
	slice1 = append(slice1, "3")
	slice1 = append(slice1, "4")

	fmt.Println(slice1)

}
